#include<iostream>
using namespace std;
typedef long long ll;
const int maxn=2e5+7;
ll n, q, a, b, t;
ll x[maxn];
ll tree[maxn<<4];
ll sum(ll a, ll b) {
  a += n; b += n;
  ll s = 0;
  while(a <= b) {
    if(a%2==1) s += tree[a++];
    if(b%2==0) s += tree[b--];
    a /= 2; b /= 2;
  }
  return s;
}
void add(ll k, ll x) {
  k += n;
  tree[k] += x;
  for(k/=2; k>=1; k/=2) {
    tree[k] = tree[2*k] + tree[2*k+1];
  }
}
int main() {
  cin>>n>>q;
  for(int i=1; i<=n; ++i) {
    cin>>x[i];
  }
  for(int i=0; i<=n; ++i) {
    add(i, x[i]);
  }
  for(int i=0; i<q; ++i) {
    cin>>t>>a>>b;
    if(t==1) {
      ll diff = b - x[a];
      add(a, diff);
    }
    else {
      cout<<sum(a, b)<<'\n';
    }
  }
  return 0;
}
